//
//  main.m
//  coffee
//
//  Created by student4 on 2020/11/7.
//  Copyright © 2020 MOSAD. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "AppDelegate.h"
#import "util/RequestConfig.h"
#import "UserRequest.h"
#import "util/LikeRequest.h"
#import "ContentRequest.h"

//void testLogin(){
//    RequestConfig *conf=[[RequestConfig alloc]init];
//    [conf initConfig];
//    UserReq *req = [[UserReq alloc]init];
//    [req initReq:conf];
//    LoginReq *lr = [[LoginReq alloc]init];
//    [lr setName:@"esuala@tom.com"];
//    [lr setPassword:@"administer"];
//    [req login:lr progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id  _Nullable responseObject) {
//        NSLog(@"请求成功:%@",((NSDictionary*)responseObject));
//       [req getInfo:@"self" progress:nil success:^(NSURLSessionDataTask * _Nonnull task, NSDictionary * _Nullable responseObject) {
//           NSLog(@"%@",responseObject[@"Info"]);
//           UserInfo *info = [[UserInfo alloc]initWith:responseObject];
//           NSLog(@"%@",[[info Info]NikeName]);
//       } failure:^(NSURLSessionDataTask *  _Nonnull task, NSError* error){
//           NSLog(@"请求失败:%@",error);
//       }];
//    } failure:^(NSURLSessionDataTask *  _Nonnull task, NSError* error){
//        NSLog(@"请求失败:%@",error);
//    }];
//}
//void testRegister(){
//    RequestConfig *conf=[[RequestConfig alloc]init];
//    [conf initConfig];
//    UserReq *req = [[UserReq alloc]init];
//    [req initReq:conf];
//    RegistReq *rr = [[RegistReq alloc]init];
//    [rr setName:@"administer"];
//    [rr setPassword:@"administer"];
//    [rr setEmail:@"esuala@tom.com"];
//    [req regist:rr progress:nil  success:^(NSURLSessionDataTask * _Nonnull task, id  _Nullable responseObject) {
//        NSLog(@"请求成功:%@",((NSDictionary*)responseObject));
//    } failure:^(NSURLSessionDataTask *  _Nonnull task, NSError* error){
//        NSLog(@"请求失败:%@",error);
//    }];
//}
//void testTextContent(){
//    RequestConfig *conf=[[RequestConfig alloc]init];
//    [conf initConfig];
//    ContentRequest *req=[[ContentRequest alloc]init];
//    [req initReq:conf];
//    [req getContentByID:@"5fbb535dd0877f6b26ea0882" progress:nil success:^(NSURLSessionDataTask * _Nonnull task, NSDictionary * _Nullable responseObject) {
//        NSLog(@"%@",responseObject);
//        // TODO: 测试textContent解析
//
//    } failure:^(NSURLSessionDataTask *  _Nonnull task, NSError* error){
//        NSLog(@"请求失败:%@",error);
//    }];
//}
//void testPostTextContent(){
//    RequestConfig *conf=[[RequestConfig alloc]init];
//    [conf initConfig];
//    UserReq *req0=[[UserReq alloc]init];
//    [req0 initReq:conf];
//    ContentRequest *req=[[ContentRequest alloc]init];
//    [req initReq:conf];
//    LoginReq *lr = [[LoginReq alloc]init];
//    [lr setName:@"test"];
//    [lr setPassword:@"test"];
//    [req0 login:lr progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id  _Nullable responseObject) {
//        NSLog(@"请求成功:%@",((NSDictionary*)responseObject));
//        TextContent *tc = [[TextContent alloc]init];
//        [tc setTitle:@"testTitle"];
//        [tc setDetail:@"testing"];
//        [tc setTags:@[@"test-tag"]];
//        [tc setIsPublic:YES];
////       [req postTextContent:@"self" progress:nil success:^(NSURLSessionDataTask * _Nonnull task, NSDictionary * _Nullable responseObject) {
////           NSLog(@"%@",responseObject[@"Info"]);
////           UserInfo *info = [[UserInfo alloc]initWith:responseObject];
////           NSLog(@"%@",[[info Info]NikeName]);
////       } failure:^(NSURLSessionDataTask *  _Nonnull task, NSError* error){
////           NSLog(@"请求失败:%@",error);
////       }];
//    } failure:^(NSURLSessionDataTask *  _Nonnull task, NSError* error){
//        NSLog(@"请求失败:%@",error);
//    }];
//}
//void testGetAlbum(){
//    RequestConfig *conf=[[RequestConfig alloc]init];
//    [conf initConfig];
//    UserReq *req0=[[UserReq alloc]init];
//    [req0 initReq:conf];
//    ContentRequest *req=[[ContentRequest alloc]init];
//    [req initReq:conf];
//
//    LoginReq *lr = [[LoginReq alloc]init];
//    [lr setName:@"user"];
//    [lr setPassword:@"user"];
//    [req0 login:lr progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id  _Nullable responseObject) {
//        NSLog(@"请求成功:%@",((NSDictionary*)responseObject));
//        ContentFileReq *cfreq = [[ContentFileReq alloc]init];
//        [cfreq setContentID:@"5fbb535dd0877f6b26ea0882"];
//        [cfreq setFilePath:@"./UserData/5fb5135fd0877f229f2fcf67/Album/160611209393055-file1-a.jpg"];
//        [req getFileBy:cfreq progress:^(NSProgress * _Nonnull p) {
//            NSLog(@"%@",p);
//        }  destination:^NSURL *(NSURL * _Nonnull targetPath, NSURLResponse * _Nonnull response) {
//            NSURL *path = [[NSFileManager defaultManager]URLForDirectory:NSDocumentDirectory inDomain:NSUserDomainMask appropriateForURL:nil create:NO error:nil];
//            return [path URLByAppendingPathComponent:@"img.jpg"];
//        } completionHandler:^(NSURLResponse * _Nonnull response, NSURL * _Nullable filePath, NSError * _Nullable error) {
//            NSLog(@"paht:%@",filePath);
//        }];
//    } failure:^(NSURLSessionDataTask *  _Nonnull task, NSError* error){
//        NSLog(@"请求失败:%@",error);
//    }];
//}
int main(int argc, char * argv[]) {
    @autoreleasepool {
//        RequestConfig *conf=[[RequestConfig alloc]init];
//        [conf initConfig];
//        UserReq *req0=[[UserReq alloc]init];
//        [req0 initReq:conf];
//        ContentRequest *req=[[ContentRequest alloc]init];
//        [req initReq:conf];
//        testLogin();
        LikeRequest *like_manager = [LikeRequest defaultLikeRequest];
        [like_manager likeContentByID:@"asjfkjsdhf" success:^{
//            [dosomething];
        } failure:^(NSString *reason) {
            ;
        }];
        [like_manager getLikeList:^(NSArray<NSString *> * userIDList) {
            ;
        } failure:^(NSString *reason) {
//            <#code#>
        }];
       
        
        return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
    }
}
